package splitting;

import java.util.*;

import org.junit.*;
import static org.junit.Assert.*;

public class StringNaturalOrderTest {

    @Ignore("Not need right now")
    @Test
    public void testStringNaturalOrder() {
        String[] strings = { "absolute", "zenka", "moment", "truth", "cena", "berzerk", "genzer", "kongo", "taichi",
                "topmass", "king", "coffee" };

        SortedSet<String> orderSet = new TreeSet<String>(Arrays.asList(strings));

        String testString = "k";

        Set<String> tailSet = orderSet.tailSet(testString);

        System.out.println(tailSet);
    }
    
    
    @Ignore ("I have learned this")
    @Test
    public void testLexicograhpicalOrderOfStringClass() {
        String[] givenStrings = { "String", "String1", "String2", "String3", "String10", "String11" };

        String[] expectSorted = { "String", "String1", "String10", "String11", "String2", "String3", };

        SortedSet<String> orderedString = new TreeSet<String>(Arrays.asList(givenStrings));

        assertArrayEquals(expectSorted, orderedString.toArray());
    }
    
    
    @Test
    public void testSortedMapWithStringNaturalOrder() {
        
        Segment[] segments = {
                new Segment("00-database-info", "7-bit ASCII code"),
                new Segment("7-bit ASCII code set", "a la mode"),
                new Segment("a posteriori", "abacterial"),
                new Segment("abaction", "abase"),
                new Segment("abasement", "abbey"),
                new Segment("abbo", "abdicator"),
                new Segment("abdomen", "aberrancy"),
                new Segment("aberrant", "abide"),
                new Segment("anglicism", "angonekton"),
                new Segment("angora", "angular modulation"),
                new Segment("Wage theory", "wardrobe dealer"),
                
        };
        
        SegmentStore store = new SegmentStore(Arrays.asList(segments));
        
        String testWord = "abaction";
        
        Segment foundSegment = store.getSegmentContains(testWord);
        
        System.out.println(foundSegment);
        
    }
}
